package org.security.config.web;

import lombok.*;

import java.util.ArrayList;
import java.util.List;

/**
 * @author jt
 * @date 2024/7/22 22:08
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class UrlPermissionConfig {

    List<UrlPermission> urlPermissionList=new ArrayList<>();

    public UrlPermissionConfig addUrlPermission(UrlPermission urlPermission){
        this.urlPermissionList.add(urlPermission);
        return this;
    }



    @Data
    @Builder
    @NoArgsConstructor
    @AllArgsConstructor
    public static class UrlPermission{
        //地址
        @Builder.Default
        String url="";

        //权限
        @Builder.Default
        String permission="";

        @Builder.Default
        String type="";

//        public  void allPermission(){
//            permission.add(BasePermissionType.all.name());
//        }

        public UrlPermission(String url) {
            this.url = url;
        }
    }

    @AllArgsConstructor
    @Getter
    public enum BasePermissionType{

        all(0,"所有权限"),//所有权限
        noAuthortication(1,"无需认证"),//
        noAuthortization(2,"无需授权");//

        @Getter
        @Setter
        public Integer code;

        @Getter
        @Setter
        public String desc;
    }

    @AllArgsConstructor
    @Getter
    public enum Type{

        no(0,"默认"),//
        login(1,"登录"),//登录
        logout(2,"登出");//登出
        @Getter
        @Setter
        public Integer code;

        @Getter
        @Setter
        public String desc;
    }
}
